<?
/**
* Copyright (c) 2002-2007 BioWare Corp.
* http://www.bigdaddymonitor.org
*
* This file is part of the BigDaddy Monitoring
* program. It is free software distributed under
* the terms of the BSD License. It is ditributed
* in the hopes that it will be useful, but
* WITHOUT ANY WARRANTY; without event the implied
* warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE.
*
* The BSD License is available from:
* http://www.opensource.org/licenses/bsd-license.php
**/
?>
<p>View a module to edit the module entry. Do NOT delete a module without consulting someone (namely Dups or Craig) as it may adversely effect BigDaddy or even stop it from functioning.</p>

<?



$pn=$_REQUEST["pn"];

if ($pn==0 || !isset($pn) || $pn=="") {
        $pn=1;
}

$max_num=30;


$sn=($pn-1)*$max_num;

$aModules = $BigDaddyData->GetAllModuleInfo($sn, $max_num);

$num_pages=ceil($aModules["nTotalRows"]/$max_num);

//Start Number
$pstr="<b>Pages:</b> ";

for ($p=1;$p<=$num_pages;$p++) 
{
	if ($p==$pn) 
	{
        $pstr.="<b>".$p."</b> ";
    } 
	else 
	{
    	$pstr.="<a href=\"index.html?page=MonModules&pn=".$p."\">".$p."</a> ";
	}
}

?>


<div class="orgbar">
<span class="text">
<?=$pstr;?>
</span>

</div>

<table border="0" cellpadding="0" cellspacing="0" width="97%">

<?

if (!is_array($aModules["aResults"]))
{
?>
	<tr valign="middle">
	<td class="lineitem">
	<div align="center"><b>No modules in the database</b></div>
	</td>
	</tr>
<?
}
else
{
	foreach ($aModules["aResults"] as $nIndex => $row)
	{
?>

	<tr valign="middle">
		<td class="lineitem" width="200">
			<a href="<?=$_SERVER["PHP_SELF"];?>?page=MonModView&modID=<?=$row["ID"];?>"><?=$row["name"];?></a>
		</td>
		<td class="lineitem" width="200">
			<?=$row["filename"];?>
		</td>
		<td class="lineitem" width="150">
			<?
			
			switch ($row["type"])
			{
				case 1:
					echo "Boolean Return";
				break;
				case 2:
					echo "String Return";
				break;
			}
			
			?>
		</td>
		<td class="lineitem" width="150">
			<?
			
			switch ($row["runfrom"])
			{
				case 1:
					echo "External (Server Only)";
				break;
				case 2:
					echo "Internal (Client Only)";
				break;
			}
			
			?>
		</td>
		
		<td class="lineitem" nowrap>
		<div class="buttons">
		<?
		if ($BigDaddy->IsUserAllowedByAction("meta-admin"))
		{
			?>
		<a href="/monitor/query_module.php?action=deletemod&modID=<?=$row["ID"];?>" onclick="javascript: return confirm('Delete this Module: <?=$row["name"];?>');">delete</a>
                <?
		}
		else
		{
			?>
			<span class="dead">delete</span>
			<?
		}
		?>
</div>
</td>
</tr>
<?
	}
}
?>

</table>
